<script type="text/javascript">
<!--
function selectApp_module(groupId, appId){
	if (appId)
	{
		var url = "__URL__/module/groupId/"+ groupId +"/appId/" + appId;
		$("#moduleSelectBox", $.pdialog.getCurrent()).loadUrl(url);
	}	
}

function selectApp_action(form$){
	var $form = $(form$, $.pdialog.getCurrent())
	var groupId = $form.find(":input[name=groupId]").val();
	var appId = $form.find(":input[name=appId]").val();
	var url = "__URL__/action/groupId/"+ groupId +"/appId/" + appId;
	$("#moduleSelectBox", $.pdialog.getCurrent()).loadUrl(url);
}
function selectModule_action(form$){
	var $form = $(form$, $.pdialog.getCurrent())
	var groupId = $form.find(":input[name=groupId]").val();
	var appId = $form.find(":input[name=appId]").val();
	var moduleId = $form.find(":input[name=moduleId]").val();

	var url = "__URL__/action/groupId/"+ groupId +"/appId/" + appId + "/moduleId/" + moduleId;
	$("#actionSelectBox", $.pdialog.getCurrent()).loadUrl(url);
}
//-->
</script>

<div class="page">
	<div class="tabs">
		<div class="tabsHeader">
			<div class="tabsHeaderContent">
				<ul>
					<li class="selected"><a href="#"><span>应用授权</span></a></li>
					<li><a href="__URL__/module/groupId/{$Think.get.groupId}" class="j-ajax"><span>模块授权</span></a></li>
					<li><a href="__URL__/action/groupId/{$Think.get.groupId}" class="j-ajax"><span>操作授权</span></a></li>
				</ul>
			</div>
		</div>
		
		<div class="tabsContent" >
			<div>
				<form method="post" action="__URL__/setApp" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone)">
					<input type="hidden" name="groupId" VALUE="{$Think.get.groupId}" />
					<div class="pageFormContent" layoutH="100">
						<volist id="item" name="appList">
							<div class="unit">			
								<input <?php echo in_array($key, $groupAppList) ? "checked" : "" ?> type="checkbox" name="groupAppId[]" value="{$key}"/>{$item}
							</div>
						</volist>
					</div>
					<div class="formBar">
						<label style="float:left"><input type="checkbox" class="checkboxCtrl" group="groupAppId[]" />全选</label>
						<ul>
							<li><div class="button"><div class="buttonContent"><button type="button" class="checkboxCtrl" group="groupAppId[]" selectType="invert">反选</button></div></div></li>
							<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
							<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
						</ul>
					</div>
				</form>				
			</div>
			
			<div>
				<div class="unit">
					<label>模块:</label>
					<select name="moduleId" onchange="selectModule_action('#setActionAction')">
						<option value="">选择</option>
						<volist id="item" name="moduleList">
						<option value="{$key}" <?php echo in_array($key, $selectModuleId) ? "selected" : "" ?>>{$item}</option>
						</volist>
					</select>
				</div>

				<div id="actionSelectBox">
					<volist id="item" name="actionList">
					<div class="unit">
						<input <?php echo in_array($key, $groupActionList) ? "checked" : "" ?> type="checkbox" name="groupActionId[]" value="{$key}"/>{$item}
					</div>
					</volist>
				</div>
			</div>
			<div>
				<volist id="item" name="actionList">
				<div class="unit">
					<input <?php echo in_array($key, $groupActionList) ? "checked" : "" ?> type="checkbox" name="groupActionId[]" value="{$key}"/>{$item}
				</div>
				</volist>
			</div>
		</div>
		<div class="tabsFooter">
			<div class="tabsFooterContent"></div>
		</div>
	</div>
</div>
